And some package and labeling info
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(factoextra) # easier visualizing outputs of prcomp
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
timeseries_dir <- 'extracted_timeseries/'
metrics_write_dir <- 'extracted_timeseries/extracted_metrics/'
# get ecs ordering/labels
esm_labels <- read.csv(paste0(timeseries_dir,'global_tas_allesms.csv'), stringsAsFactors = FALSE) %>%
select(esm) %>% distinct %>%
mutate(plotesm = paste0(letters[as.integer(row.names(.))], '.', esm),
ECS_order = as.integer(row.names(.)))
print(esm_labels)
## esm plotesm ECS_order
## 1 CAMS-CSM1-0 a.CAMS-CSM1-0 1
## 2 MIROC6 b.MIROC6 2
## 3 GFDL-ESM4 c.GFDL-ESM4 3
## 4 FGOALS-g3 d.FGOALS-g3 4
## 5 MPI-ESM1-2-HR e.MPI-ESM1-2-HR 5
## 6 MPI-ESM1-2-LR f.MPI-ESM1-2-LR 6
## 7 MRI-ESM2-0 g.MRI-ESM2-0 7
## 8 ACCESS-ESM1-5 h.ACCESS-ESM1-5 8
## 9 IPSL-CM6A-LR i.IPSL-CM6A-LR 9
## 10 CESM2-WACCM j.CESM2-WACCM 10
## 11 UKESM1-0-LL k.UKESM1-0-LL 11
## 12 CanESM5 l.CanESM5 12
we want the shapes for plotting anyway, so prep them
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
## Reading layer `IPCC-WGI-reference-regions-v4' from data source
## `/Users/snyd535/Documents/GitHub/stitches_in_r/R/inst/shinyApp/python_curation/IPCC-WGI-reference-regions-v4_shapefile/IPCC-WGI-reference-regions-v4.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 58 features and 4 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -180 ymin: -90 xmax: 180 ymax: 90
## Geodetic CRS: WGS 84
region_summary_main <- read.csv(paste0(metrics_write_dir, 'IPCC_land_regions_allESMs_ensavg_tp_metrics.csv'),
stringsAsFactors = FALSE)
region_summary_main %>%
filter(experiment != 'ssp119',
experiment != 'ssp434',
experiment != 'ssp460',
experiment != 'ssp534-over') ->
region_summary
print(head(region_summary))
## esm experiment region iasd tas_change pr_pct
## 1 CAMS-CSM1-0 ssp126 ARP 0.3310797 0.7217781 10.495059
## 2 CAMS-CSM1-0 ssp126 CAF 0.3406182 0.6534092 2.542290
## 3 CAMS-CSM1-0 ssp126 CAR 0.1843266 0.4755080 -3.296680
## 4 CAMS-CSM1-0 ssp126 CAU 0.4651680 0.7300895 3.032642
## 5 CAMS-CSM1-0 ssp126 CNA 0.5538641 0.7759938 4.609668
## 6 CAMS-CSM1-0 ssp126 EAS 0.3169825 0.9085901 3.753970
idea is that there’s something really similar across ESMs, especially for SSP126/245 -> their RGB maps have so much in common.
is there a sort of core map that gets deviations added to as you move through scenarios and ESMs? Or how many distinct maps do we actually have
And the aim of the archive is to establish that our selection of ESMs forms a spanning set of vectors for all/most of CMIP6
observation = scenarioXesm
individual variable is a regionXmetric
so each observation vector is 3*Nregions long:
<Tr1...Trn, Pr1...Prn, IASDr1...IASDrn > for a
scenarioXesm <-> there are 48 observations for each of 129
variables
And then becaues we’re interested in a pseudo-basis for the CMIP6 archive, we want the training data to be all scenarios and ESMs
Out of sample tests -> how does basis do on overshoots that it doesn’t train on; withhold one of the 12 ESMs and learn from other 11 to see how it goes; then see how a completely external ESM does on training from all 12
nothing a priori to preclude us from doing EOFs on the gridded time series data, or the gridded metrics, but having on IPCC regions avoids the issue of all ESMs being on their own grids
and overall doing region metrics helps keep data size operating on manageable
# reshape:
grouped_data <- split(region_summary, list(region_summary$esm, region_summary$experiment))
shaped_data <- lapply(grouped_data, function(group){
group %>%
select(esm, experiment, region, tas_change) %>%
mutate(metric = 'tas_change') %>%
rename(value = tas_change) %>%
bind_rows( group %>%
select(esm, experiment, region, pr_pct) %>%
mutate(metric = 'pr_pct') %>%
rename(value = pr_pct),
group %>%
select(esm, experiment, region, iasd) %>%
mutate(metric = 'iasd') %>%
rename(value = iasd)
) ->
reshaped
reshaped %>%
mutate(row_id = paste0(region, '~', metric),
col_id = paste0(esm, '~', experiment)) %>%
select(-esm, -experiment, -region, -metric)->
reshaped2
colnames(reshaped2) <- c(paste0(unique(reshaped2$col_id)), 'row_id', 'col_id')
rownames(reshaped2) <- paste0(reshaped2$row_id)
reshaped2 %>%
select(-col_id, -row_id) ->
out
return(out)
}
)
# combine columns but then transpose because prcomp wants rows to be observations
# and columns to be variables (but doing it the other way first is easier to code)
data <- t(do.call(cbind, shaped_data) )
print(head(data))
## ARP~tas_change CAF~tas_change CAR~tas_change
## ACCESS-ESM1-5~ssp126 2.0934292 1.4062035 1.2637948
## CAMS-CSM1-0~ssp126 0.7217781 0.6534092 0.4755080
## CanESM5~ssp126 1.8852330 1.4174536 1.2169352
## CESM2-WACCM~ssp126 1.3786494 1.5680946 1.1636474
## FGOALS-g3~ssp126 0.5764236 0.4784259 0.3660500
## GFDL-ESM4~ssp126 0.8411439 0.8912358 0.5852106
## CAU~tas_change CNA~tas_change EAS~tas_change
## ACCESS-ESM1-5~ssp126 1.4220469 1.9358447 2.0989347
## CAMS-CSM1-0~ssp126 0.7300895 0.7759938 0.9085901
## CanESM5~ssp126 1.5954996 2.3281459 1.8941794
## CESM2-WACCM~ssp126 1.9348767 2.1549397 1.5537137
## FGOALS-g3~ssp126 0.6114476 1.0052793 0.8390909
## GFDL-ESM4~ssp126 0.7623585 1.3529410 1.1177500
## EAU~tas_change ECA~tas_change EEU~tas_change
## ACCESS-ESM1-5~ssp126 1.2895340 2.1831134 2.2892746
## CAMS-CSM1-0~ssp126 0.7745160 1.2119103 0.9167158
## CanESM5~ssp126 1.3152452 2.3901285 2.5315036
## CESM2-WACCM~ssp126 1.5581398 1.6295139 1.8464658
## FGOALS-g3~ssp126 0.5094309 0.6871101 1.1511501
## GFDL-ESM4~ssp126 0.6682136 1.0434035 1.2996841
## ENA~tas_change ESAF~tas_change ESB~tas_change
## ACCESS-ESM1-5~ssp126 1.9531506 1.4106781 2.2502906
## CAMS-CSM1-0~ssp126 0.8043893 0.7667614 1.0212179
## CanESM5~ssp126 2.1455629 1.3633206 2.4667860
## CESM2-WACCM~ssp126 1.9160322 1.5008813 1.6024391
## FGOALS-g3~ssp126 0.7230922 0.4964863 0.8714566
## GFDL-ESM4~ssp126 1.0638501 0.8287609 1.1677105
## MDG~tas_change MED~tas_change NAU~tas_change
## ACCESS-ESM1-5~ssp126 1.0452862 1.9713492 1.1089889
## CAMS-CSM1-0~ssp126 0.6119823 0.8296688 0.6303114
## CanESM5~ssp126 1.0390257 1.8284683 1.1681050
## CESM2-WACCM~ssp126 1.3760163 1.0973002 1.2702710
## FGOALS-g3~ssp126 0.3929008 0.6431663 0.4203934
## GFDL-ESM4~ssp126 0.5653914 0.6991397 0.6855748
## NCA~tas_change NEAF~tas_change NEN~tas_change
## ACCESS-ESM1-5~ssp126 1.5912180 1.5358975 2.7149723
## CAMS-CSM1-0~ssp126 0.6633229 0.7093529 0.9960863
## CanESM5~ssp126 1.5765876 1.3340496 4.5553824
## CESM2-WACCM~ssp126 1.2676374 1.5218842 1.9760455
## FGOALS-g3~ssp126 0.5544840 0.5455810 0.6942852
## GFDL-ESM4~ssp126 0.7696499 0.8983929 1.3632204
## NES~tas_change NEU~tas_change NSA~tas_change
## ACCESS-ESM1-5~ssp126 1.4903296 1.51801186 1.8506780
## CAMS-CSM1-0~ssp126 0.6592798 0.82181829 0.7697682
## CanESM5~ssp126 1.3314695 2.19060249 1.7336859
## CESM2-WACCM~ssp126 1.5911223 -0.03199914 1.6424690
## FGOALS-g3~ssp126 0.4939628 1.11296451 0.6270929
## GFDL-ESM4~ssp126 0.6936329 0.24100943 0.7868828
## NWN~tas_change NWS~tas_change NZ~tas_change RAR~tas_change
## ACCESS-ESM1-5~ssp126 2.7348119 1.5307142 0.7406556 3.457196
## CAMS-CSM1-0~ssp126 0.8965775 0.7295597 0.6059787 1.145034
## CanESM5~ssp126 3.4570155 1.5530009 0.9388703 4.630259
## CESM2-WACCM~ssp126 2.2374890 1.9205793 1.4837555 1.750642
## FGOALS-g3~ssp126 1.2433120 0.5237937 0.2526121 1.495634
## GFDL-ESM4~ssp126 1.8303868 0.7855722 0.7064299 1.785258
## RFE~tas_change SAH~tas_change SAM~tas_change
## ACCESS-ESM1-5~ssp126 3.266435 1.7050254 1.8835550
## CAMS-CSM1-0~ssp126 1.173314 0.7850004 0.8191777
## CanESM5~ssp126 3.255857 1.8636135 2.1015963
## CESM2-WACCM~ssp126 1.621816 1.3114837 2.2278074
## FGOALS-g3~ssp126 1.204721 0.5719378 0.7817236
## GFDL-ESM4~ssp126 1.263729 0.7148224 1.0488282
## SAS~tas_change SAU~tas_change SCA~tas_change
## ACCESS-ESM1-5~ssp126 1.5908700 0.7386580 1.4458824
## CAMS-CSM1-0~ssp126 0.9518576 0.5529406 0.5536521
## CanESM5~ssp126 1.6079998 1.1198892 1.3011629
## CESM2-WACCM~ssp126 1.6356668 1.7042063 1.4364245
## FGOALS-g3~ssp126 0.7379951 0.2896555 0.4554234
## GFDL-ESM4~ssp126 0.8288891 0.7113674 0.6165945
## SEA~tas_change SEAF~tas_change SES~tas_change
## ACCESS-ESM1-5~ssp126 1.1184793 1.2953887 1.0946185
## CAMS-CSM1-0~ssp126 0.5820659 0.6953120 0.7674232
## CanESM5~ssp126 1.0876748 1.2299304 1.3316505
## CESM2-WACCM~ssp126 1.2009140 1.3684934 1.4680832
## FGOALS-g3~ssp126 0.4118435 0.4773606 0.5783907
## GFDL-ESM4~ssp126 0.5919785 0.7046315 0.5440557
## SSA~tas_change SWS~tas_change TIB~tas_change
## ACCESS-ESM1-5~ssp126 0.5902395 1.1547694 1.9284752
## CAMS-CSM1-0~ssp126 0.6695490 0.7899058 1.1339967
## CanESM5~ssp126 0.9038120 1.2893941 2.3835126
## CESM2-WACCM~ssp126 1.0954179 1.8372937 1.7005147
## FGOALS-g3~ssp126 0.2333876 0.3926882 0.9408433
## GFDL-ESM4~ssp126 0.2691064 0.5686243 1.1235318
## WAF~tas_change WCA~tas_change WCE~tas_change
## ACCESS-ESM1-5~ssp126 1.2791882 1.9844075 2.0293787
## CAMS-CSM1-0~ssp126 0.6296341 0.9718002 0.9347833
## CanESM5~ssp126 1.4105439 2.3467585 2.1026717
## CESM2-WACCM~ssp126 1.6248508 1.4279467 0.9626398
## FGOALS-g3~ssp126 0.4484555 0.6767533 1.0241204
## GFDL-ESM4~ssp126 0.7743951 1.0176262 0.6653833
## WNA~tas_change WSAF~tas_change WSB~tas_change ARP~pr_pct
## ACCESS-ESM1-5~ssp126 2.0001638 1.2742664 2.4279983 17.8083242
## CAMS-CSM1-0~ssp126 0.7993220 0.7928992 0.8869747 10.4950593
## CanESM5~ssp126 2.2529770 1.2754883 2.6071794 22.0614141
## CESM2-WACCM~ssp126 1.7196012 1.5502475 2.0008339 -6.0836896
## FGOALS-g3~ssp126 0.8937319 0.4679298 1.0708816 0.4480658
## GFDL-ESM4~ssp126 1.2331233 0.6397595 1.4347309 -8.6858336
## CAF~pr_pct CAR~pr_pct CAU~pr_pct CNA~pr_pct EAS~pr_pct
## ACCESS-ESM1-5~ssp126 4.802294 0.91249230 -18.988714 5.986393 9.975080
## CAMS-CSM1-0~ssp126 2.542290 -3.29668018 3.032642 4.609668 3.753970
## CanESM5~ssp126 2.380664 -0.09659676 -5.819530 5.226974 12.118283
## CESM2-WACCM~ssp126 3.360142 -1.48478112 -11.191524 7.913570 9.792656
## FGOALS-g3~ssp126 1.659645 -0.35135585 -8.604146 4.882122 3.602823
## GFDL-ESM4~ssp126 -2.313183 2.41507831 2.732119 5.519044 12.045389
## EAU~pr_pct ECA~pr_pct EEU~pr_pct ENA~pr_pct ESAF~pr_pct
## ACCESS-ESM1-5~ssp126 -10.966383 9.899637 6.81174700 4.964758 -3.1452791
## CAMS-CSM1-0~ssp126 -2.754635 4.463063 9.12666105 3.301678 -0.2873758
## CanESM5~ssp126 -3.790219 20.041678 14.63584506 7.898051 -2.1555418
## CESM2-WACCM~ssp126 -7.384505 8.386046 -0.07143208 5.547802 0.8617502
## FGOALS-g3~ssp126 -7.781255 3.406534 1.60720250 4.362852 -1.6463541
## GFDL-ESM4~ssp126 8.186249 9.399361 6.05827484 5.193655 -6.7301858
## ESB~pr_pct MDG~pr_pct MED~pr_pct NAU~pr_pct NCA~pr_pct
## ACCESS-ESM1-5~ssp126 8.624050 -5.91061588 -2.454031 -17.043933 8.9489967
## CAMS-CSM1-0~ssp126 6.292838 0.04263978 -4.178746 3.156916 -0.9408235
## CanESM5~ssp126 17.944713 -2.67952928 6.344953 -2.397952 1.6046830
## CESM2-WACCM~ssp126 9.261028 2.68946558 -8.067536 -6.364779 -7.8654204
## FGOALS-g3~ssp126 2.288749 1.08263531 1.631689 -6.726893 -0.2953103
## GFDL-ESM4~ssp126 9.299210 -4.81246489 -4.729360 -2.074986 0.5596858
## NEAF~pr_pct NEN~pr_pct NES~pr_pct NEU~pr_pct NSA~pr_pct
## ACCESS-ESM1-5~ssp126 10.077610 9.007795 -13.7448826 6.886273 -12.0583503
## CAMS-CSM1-0~ssp126 3.123002 4.876864 1.5155029 3.316470 -3.2897948
## CanESM5~ssp126 21.804888 16.011182 -8.0151587 7.756827 -4.3631985
## CESM2-WACCM~ssp126 13.133821 5.220584 1.6812690 -1.125700 -5.6346166
## FGOALS-g3~ssp126 1.575185 1.294948 -9.8705206 4.272959 -7.1972711
## GFDL-ESM4~ssp126 -5.270581 5.075795 0.8601996 1.111796 0.5243156
## NWN~pr_pct NWS~pr_pct NZ~pr_pct RAR~pr_pct RFE~pr_pct
## ACCESS-ESM1-5~ssp126 9.770617 0.4775363 0.17655651 17.298720 14.609133
## CAMS-CSM1-0~ssp126 4.899197 0.6721096 2.42057655 4.680120 4.346756
## CanESM5~ssp126 17.013424 2.7069502 2.21102064 19.945462 17.017660
## CESM2-WACCM~ssp126 9.689616 8.0014397 1.59385680 6.711572 7.526394
## FGOALS-g3~ssp126 3.522335 2.0351886 0.08075562 7.679549 5.266941
## GFDL-ESM4~ssp126 7.680811 1.9110903 2.44653752 8.354107 7.387132
## SAH~pr_pct SAM~pr_pct SAS~pr_pct SAU~pr_pct SCA~pr_pct
## ACCESS-ESM1-5~ssp126 8.210525028 -6.28679392 20.342389 -4.2078786 -4.1538098
## CAMS-CSM1-0~ssp126 -7.919596573 -0.03215533 8.536154 4.2093456 -2.4559764
## CanESM5~ssp126 11.126171823 -6.72256310 22.448377 0.2358411 0.4823518
## CESM2-WACCM~ssp126 -9.229323668 -4.77370911 -1.936698 -4.3105229 -4.4722873
## FGOALS-g3~ssp126 0.006822516 -4.02300757 1.775290 -1.7894866 -1.0578645
## GFDL-ESM4~ssp126 -6.229768349 -3.73522691 4.731504 2.4560930 3.1678663
## SEA~pr_pct SEAF~pr_pct SES~pr_pct SSA~pr_pct SWS~pr_pct
## ACCESS-ESM1-5~ssp126 0.6988214 8.361002 4.5346317 0.3520698 -3.1709082
## CAMS-CSM1-0~ssp126 1.7756235 2.774763 0.4861554 1.1393758 -0.5340962
## CanESM5~ssp126 3.2003475 11.322734 -1.7657869 2.5898074 -1.0187152
## CESM2-WACCM~ssp126 -1.2965307 15.727923 12.6681879 4.0072793 -6.5793998
## FGOALS-g3~ssp126 -0.1631520 4.197887 -0.4345055 1.3098680 2.2441232
## GFDL-ESM4~ssp126 -0.2824819 -7.285253 4.3045796 0.9796275 -2.4725307
## TIB~pr_pct WAF~pr_pct WCA~pr_pct WCE~pr_pct WNA~pr_pct
## ACCESS-ESM1-5~ssp126 8.213732 6.7770886 8.4239712 1.534532 2.693245
## CAMS-CSM1-0~ssp126 1.190256 -3.7879156 -1.0941888 3.872230 4.112405
## CanESM5~ssp126 14.853800 7.5891273 10.3024486 12.532110 8.826424
## CESM2-WACCM~ssp126 5.907547 -3.1308404 1.7683451 1.351605 12.570646
## FGOALS-g3~ssp126 6.585875 -4.7944240 0.1873814 2.716263 2.957199
## GFDL-ESM4~ssp126 1.570006 -0.4456742 -0.2706232 5.144191 5.386374
## WSAF~pr_pct WSB~pr_pct ARP~iasd CAF~iasd CAR~iasd
## ACCESS-ESM1-5~ssp126 -4.542451 6.026889 0.2595744 0.2460587 0.1434874
## CAMS-CSM1-0~ssp126 -1.542203 14.052179 0.3310797 0.3406182 0.1843266
## CanESM5~ssp126 -4.314911 14.294614 0.2883932 0.2030842 0.1761441
## CESM2-WACCM~ssp126 -4.626141 3.054083 0.3195268 0.2783613 0.1891238
## FGOALS-g3~ssp126 -2.601580 1.525639 0.2432766 0.2182353 0.1435025
## GFDL-ESM4~ssp126 -2.977972 4.644924 0.2646159 0.2395148 0.1509197
## CAU~iasd CNA~iasd EAS~iasd EAU~iasd ECA~iasd
## ACCESS-ESM1-5~ssp126 0.4614042 0.5766090 0.2489424 0.3937830 0.3914894
## CAMS-CSM1-0~ssp126 0.4651680 0.5538641 0.3169825 0.4210074 0.5339960
## CanESM5~ssp126 0.6351561 0.5795052 0.2794158 0.4056580 0.5424971
## CESM2-WACCM~ssp126 0.4068432 0.6244597 0.3210915 0.3327063 0.4805447
## FGOALS-g3~ssp126 0.4166424 0.5327155 0.3394420 0.2889162 0.5249575
## GFDL-ESM4~ssp126 0.5263620 0.5022275 0.2331458 0.4699188 0.4121330
## EEU~iasd ENA~iasd ESAF~iasd ESB~iasd MDG~iasd
## ACCESS-ESM1-5~ssp126 0.6888277 0.3876687 0.3103095 0.5355070 0.2442362
## CAMS-CSM1-0~ssp126 0.7102448 0.4058755 0.3076424 0.6348455 0.2393575
## CanESM5~ssp126 0.7338188 0.3643293 0.3077647 0.6533199 0.2097663
## CESM2-WACCM~ssp126 0.8513960 0.4147039 0.3013756 0.6936958 0.2440572
## FGOALS-g3~ssp126 0.9877454 0.3735745 0.2444139 0.6526930 0.2183430
## GFDL-ESM4~ssp126 0.8155413 0.3286888 0.3685756 0.5039846 0.2080200
## MED~iasd NAU~iasd NCA~iasd NEAF~iasd NEN~iasd
## ACCESS-ESM1-5~ssp126 0.2857466 0.2556370 0.2358312 0.2353691 0.6053607
## CAMS-CSM1-0~ssp126 0.3330697 0.2835811 0.2909702 0.3362006 0.5292216
## CanESM5~ssp126 0.2733015 0.2608473 0.2490052 0.2500586 0.5666950
## CESM2-WACCM~ssp126 0.3002195 0.3880132 0.2806995 0.2474704 0.6610628
## FGOALS-g3~ssp126 0.3284365 0.2249427 0.2609761 0.2464567 0.7145720
## GFDL-ESM4~ssp126 0.3158473 0.2960050 0.2593858 0.2912263 0.5166765
## NES~iasd NEU~iasd NSA~iasd NWN~iasd NWS~iasd
## ACCESS-ESM1-5~ssp126 0.3947011 0.5116276 0.4250832 0.6478831 0.3368728
## CAMS-CSM1-0~ssp126 0.2906486 0.6079654 0.3594712 0.6549496 0.3450007
## CanESM5~ssp126 0.4404834 0.3871334 0.6742291 0.7743143 0.4725138
## CESM2-WACCM~ssp126 0.4231833 0.5738235 0.4141264 0.7479106 0.4517747
## FGOALS-g3~ssp126 0.2479011 0.7261948 0.3385824 0.8520440 0.3037833
## GFDL-ESM4~ssp126 0.3575382 0.5148484 0.4018306 0.7376878 0.3388734
## NZ~iasd RAR~iasd RFE~iasd SAH~iasd SAM~iasd
## ACCESS-ESM1-5~ssp126 0.2367744 0.6591517 0.4177139 0.2693830 0.5031998
## CAMS-CSM1-0~ssp126 0.2381873 0.5332794 0.4653741 0.3457771 0.4129497
## CanESM5~ssp126 0.1974291 0.6993443 0.4182200 0.3032327 0.7237930
## CESM2-WACCM~ssp126 0.2665312 0.7953580 0.4786184 0.4096292 0.4826159
## FGOALS-g3~ssp126 0.1844287 0.6728883 0.6183573 0.2502918 0.4192764
## GFDL-ESM4~ssp126 0.2779192 0.6133216 0.4583642 0.2783958 0.4497530
## SAS~iasd SAU~iasd SCA~iasd SEA~iasd SEAF~iasd
## ACCESS-ESM1-5~ssp126 0.2692973 0.2386236 0.2265212 0.1210887 0.2071118
## CAMS-CSM1-0~ssp126 0.2952441 0.2249501 0.2435609 0.2053740 0.2970027
## CanESM5~ssp126 0.3196038 0.2223254 0.2574777 0.1052468 0.2576975
## CESM2-WACCM~ssp126 0.3410049 0.2238038 0.2557622 0.1961225 0.2327455
## FGOALS-g3~ssp126 0.2151844 0.1879559 0.2144119 0.1652803 0.2244940
## GFDL-ESM4~ssp126 0.2543625 0.2268227 0.2344991 0.1495815 0.2345583
## SES~iasd SSA~iasd SWS~iasd TIB~iasd WAF~iasd
## ACCESS-ESM1-5~ssp126 0.2903325 0.2412129 0.2617533 0.2807335 0.2708157
## CAMS-CSM1-0~ssp126 0.3586119 0.2553562 0.3066687 0.4298224 0.3152778
## CanESM5~ssp126 0.3143773 0.2042021 0.2596287 0.5149744 0.2499668
## CESM2-WACCM~ssp126 0.3225192 0.2416382 0.3346728 0.3579184 0.3364580
## FGOALS-g3~ssp126 0.2496672 0.2825341 0.2145532 0.3522739 0.2154399
## GFDL-ESM4~ssp126 0.3228440 0.2765938 0.2860680 0.3419883 0.2473492
## WCA~iasd WCE~iasd WNA~iasd WSAF~iasd WSB~iasd
## ACCESS-ESM1-5~ssp126 0.3764538 0.5743571 0.4623572 0.2658966 0.6660748
## CAMS-CSM1-0~ssp126 0.5181384 0.6235452 0.4666619 0.2425287 0.7592543
## CanESM5~ssp126 0.4565611 0.5088701 0.5542324 0.2544136 0.7561828
## CESM2-WACCM~ssp126 0.4298636 0.6125324 0.5337985 0.3138779 0.8537584
## FGOALS-g3~ssp126 0.4189535 0.7259719 0.5703651 0.2247946 0.8483985
## GFDL-ESM4~ssp126 0.3961498 0.6131900 0.4419899 0.3016356 0.6515188
data_pca <- prcomp(data, center=TRUE, scale = TRUE)
# quick visualize
factoextra::fviz_eig(data_pca)
# coordinates of each ESM-SSP combo in the PCs
data_pca$x %>%
as.data.frame() %>%
mutate(id = row.names(.)) %>%
separate(id, into=c('model', 'scenario'), sep = '~') %>%
select(model, scenario, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9)->
coordinates
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC2, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC2, color = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC3, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC3, color = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC4, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC1, y = PC4, color = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC2, y = PC3, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC2, y = PC3, color = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC2, y = PC4, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC2, y = PC4, color = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC3, y = PC4, color = model, shape = scenario))
ggplot(coordinates) +
geom_point(mapping = aes(x = PC3, y = PC4, color = scenario))
pcs <- data_pca$rotation
str(pcs)
## num [1:129, 1:48] 0.13 0.125 0.129 0.128 0.128 ...
## - attr(*, "dimnames")=List of 2
## ..$ : chr [1:129] "ARP~tas_change" "CAF~tas_change" "CAR~tas_change" "CAU~tas_change" ...
## ..$ : chr [1:48] "PC1" "PC2" "PC3" "PC4" ...
# pull the region and metric info back in
as.data.frame(pcs) %>%
mutate(row_id = row.names(.)) %>%
separate(row_id, into = c('region', 'metric'), sep ='~') ->
tmp
# We want to convert each set of 3 metrics in a region to a single
# rgb coded value.
# and we want all on same color scale.
# so reshape for each metric (which goes to one of r, g, b)
# with all PCs want to consider stacked.
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC1) %>%
rename(tas_change = PC1) %>%
mutate(pc = 'PC1') %>%
bind_rows(tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC2) %>%
rename(tas_change = PC2) %>%
mutate(pc = 'PC2'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC3) %>%
rename(tas_change = PC3) %>%
mutate(pc = 'PC3') ,
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC4) %>%
rename(tas_change = PC4) %>%
mutate(pc = 'PC4'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC5) %>%
rename(tas_change = PC5) %>%
mutate(pc = 'PC5'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC6) %>%
rename(tas_change = PC6) %>%
mutate(pc = 'PC6'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC7) %>%
rename(tas_change = PC7) %>%
mutate(pc = 'PC7'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC8) %>%
rename(tas_change = PC8) %>%
mutate(pc = 'PC8'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC9) %>%
rename(tas_change = PC9) %>%
mutate(pc = 'PC9'),
tmp %>%
filter(metric == 'tas_change') %>%
select(region, metric, PC10) %>%
rename(tas_change = PC10) %>%
mutate(pc = 'PC10')
) ->
tas
print(head(tas))
## region metric tas_change pc
## ARP~tas_change...1 ARP tas_change 0.1298692 PC1
## CAF~tas_change...2 CAF tas_change 0.1251125 PC1
## CAR~tas_change...3 CAR tas_change 0.1287444 PC1
## CAU~tas_change...4 CAU tas_change 0.1282287 PC1
## CNA~tas_change...5 CNA tas_change 0.1282116 PC1
## EAS~tas_change...6 EAS tas_change 0.1293579 PC1
print(tail(tas))
## region metric tas_change pc
## WAF~tas_change...425 WAF tas_change 0.0163938075 PC10
## WCA~tas_change...426 WCA tas_change 0.0074053689 PC10
## WCE~tas_change...427 WCE tas_change -0.0352215926 PC10
## WNA~tas_change...428 WNA tas_change 0.0165908711 PC10
## WSAF~tas_change...429 WSAF tas_change -0.0165551020 PC10
## WSB~tas_change...430 WSB tas_change 0.0009282167 PC10
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC1) %>%
rename(pr_pct = PC1) %>%
mutate(pc = 'PC1') %>%
bind_rows(tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC2) %>%
rename(pr_pct = PC2) %>%
mutate(pc = 'PC2'),
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC3) %>%
rename(pr_pct = PC3) %>%
mutate(pc = 'PC3') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC4) %>%
rename(pr_pct = PC4) %>%
mutate(pc = 'PC4') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC5) %>%
rename(pr_pct = PC5) %>%
mutate(pc = 'PC5') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC6) %>%
rename(pr_pct = PC6) %>%
mutate(pc = 'PC6') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC7) %>%
rename(pr_pct = PC7) %>%
mutate(pc = 'PC7') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC8) %>%
rename(pr_pct = PC8) %>%
mutate(pc = 'PC8') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC9) %>%
rename(pr_pct = PC9) %>%
mutate(pc = 'PC9') ,
tmp %>%
filter(metric == 'pr_pct') %>%
select(region, metric, PC10) %>%
rename(pr_pct = PC10) %>%
mutate(pc = 'PC10')
) ->
pr
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC1) %>%
rename(iasd = PC1) %>%
mutate(pc = 'PC1') %>%
bind_rows(tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC2) %>%
rename(iasd = PC2) %>%
mutate(pc = 'PC2'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC3) %>%
rename(iasd = PC3) %>%
mutate(pc = 'PC3') ,
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC4) %>%
rename(iasd = PC4) %>%
mutate(pc = 'PC4') ,
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC5) %>%
rename(iasd = PC5) %>%
mutate(pc = 'PC5'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC6) %>%
rename(iasd = PC6) %>%
mutate(pc = 'PC6'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC6) %>%
rename(iasd = PC6) %>%
mutate(pc = 'PC6'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC7) %>%
rename(iasd = PC7) %>%
mutate(pc = 'PC7'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC8) %>%
rename(iasd = PC8) %>%
mutate(pc = 'PC8'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC9) %>%
rename(iasd = PC9) %>%
mutate(pc = 'PC9'),
tmp %>%
filter(metric == 'iasd') %>%
select(region, metric, PC10) %>%
rename(iasd = PC10) %>%
mutate(pc = 'PC10')
) ->
iasd
tas %>%
select(-metric) %>%
left_join(pr %>% select(-metric), by =c('region', 'pc')) %>%
left_join(iasd %>% select(-metric), by =c('region', 'pc')) ->
colored_pcs
colored_pcs$r <- scales::rescale(colored_pcs$tas_change, to =c(0,255))
colored_pcs$g <- scales::rescale(colored_pcs$iasd, to =c(0,255))
colored_pcs$b <- scales::rescale(colored_pcs$pr_pct, to =c(0,255))
colored_pcs %>%
left_join(as.data.frame(shp) %>% select(Acronym, mean_lon, mean_lat), by = c('region' = 'Acronym')) %>%
rename(lon = mean_lon, lat = mean_lat) %>%
mutate(color = rgb(.$r, .$g, .$b, maxColorValue = 255),
color_order = as.integer(row.names(.))) ->
pc_plotting
pc_plotting %>%
select(color_order, color) %>%
distinct() ->
colors
shp %>%
left_join(pc_plotting, by = c('Acronym' = 'region'))->
shp_pcs
p<- ggplot() +
geom_sf(data = shp_pcs %>% filter(pc != 'PC10') %>% na.omit, aes(fill = as.factor(color_order)) ) +
scale_fill_manual(values =colors$color)+
facet_wrap(~pc, ncol=3) +
theme(legend.position = 'none')
p
#look at whether Precip inc or dec -> not just the PCs' precip entries >= 0
# because standardized/
as.data.frame(data_pca$center) %>%
mutate(row_id = row.names(.)) %>%
filter(grepl('pr_pct', row_id)) %>%
separate(row_id, into = c('region', 'trash'), sep = '~') %>%
select(-trash) ->
pr_centers
as.data.frame(data_pca$scale) %>%
mutate(row_id = row.names(.)) %>%
filter(grepl('pr_pct', row_id)) %>%
separate(row_id, into = c('region', 'trash'), sep = '~') %>%
select(-trash) ->
pr_scales
shp_pcs %>%
left_join(pr_centers, by = c('Acronym'='region')) %>%
left_join(pr_scales, by = c('Acronym'='region')) %>%
mutate(precip_change = if_else( ((pr_pct*`data_pca$scale`)- `data_pca$center`) >=0, 'inc', 'dec'))->
shp_pcs2
ggplot() +
geom_sf(data = shp_pcs2 %>% filter(pc != 'PC10') %>% na.omit, aes(#fill = as.factor(color_order),
color = precip_change )) +
#scale_fill_manual(values =colors$orig_color)+
scale_color_manual(values = c('red', 'blue'))+
facet_wrap(~pc, ncol=3) +
theme(legend.position = 'none')
Is this set of 12 ESMs and 4 scenarios a spanning set - can I use the basis estimated from these 48 observations to do a credible job producing the metrics for an out of sample ESM or Scenario?
# pull off and reshape the ssp460 data
region_summary_main %>%
filter(experiment == 'ssp460' ) ->
region_460
# reshape:
grouped_data <- split(region_460, list(region_460$esm, region_460$experiment))
shaped_data <- lapply(grouped_data, function(group){
group %>%
select(esm, experiment, region, tas_change) %>%
mutate(metric = 'tas_change') %>%
rename(value = tas_change) %>%
bind_rows( group %>%
select(esm, experiment, region, pr_pct) %>%
mutate(metric = 'pr_pct') %>%
rename(value = pr_pct),
group %>%
select(esm, experiment, region, iasd) %>%
mutate(metric = 'iasd') %>%
rename(value = iasd)
) ->
reshaped
reshaped %>%
mutate(row_id = paste0(region, '~', metric),
col_id = paste0(esm, '~', experiment)) %>%
select(-esm, -experiment, -region, -metric)->
reshaped2
colnames(reshaped2) <- c(paste0(unique(reshaped2$col_id)), 'row_id', 'col_id')
rownames(reshaped2) <- paste0(reshaped2$row_id)
reshaped2 %>%
select(-col_id, -row_id) ->
out
return(out)
}
)
# combine columns but then transpose because prcomp wants rows to be observations
# and columns to be variables (but doing it the other way first is easier to code)
data_460 <- t(do.call(cbind, shaped_data) )
print(head(data_460))
data_460_coords <- predict(data_pca, newdata = data_460)
print(head(data_460_coords))
data_460_coords %>%
as.data.frame() %>%
mutate(id = row.names(.)) %>%
separate(id, into=c('model', 'scenario'), sep = '~') %>%
select(model, scenario, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9) %>%
bind_rows(coordinates) ->
coordinates
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC2, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC2, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC2, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC2), color = 'black', shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC3, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC3, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC3, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC3), color = 'black', shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC4, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC4, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC1, y = PC4, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC1, y = PC4), color = 'black', shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC2, y = PC3, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC2, y = PC3, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC2, y = PC3, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC2, y = PC3), color = 'black', shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC2, y = PC4, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC2, y = PC4, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC2, y = PC4, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC2, y = PC4), color = 'black', shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC3, y = PC4, color = model, shape = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC3, y = PC4, color = model), shape = 9, size =3.5)
ggplot() +
geom_point(data = coordinates %>% filter(scenario !='ssp460'),
mapping = aes(x = PC3, y = PC4, color = scenario)) +
geom_point(data = coordinates %>% filter(scenario =='ssp460'),
mapping = aes(x = PC3, y = PC4), color = 'black', shape = 9, size =3.5)
region_summary_main <- read.csv(paste0(metrics_write_dir, 'IPCC_land_regions_oosESMs_ensavg_tp_metrics.csv'),
stringsAsFactors = FALSE)
region_summary_main %>%
filter(experiment != 'ssp119',
experiment != 'ssp434',
experiment != 'ssp460',
experiment != 'ssp534-over') ->
region_summary
# reshape:
grouped_data <- split(region_summary, list(region_summary$esm, region_summary$experiment))
shaped_data <- lapply(grouped_data, function(group){
group %>%
select(esm, experiment, region, tas_change) %>%
mutate(metric = 'tas_change') %>%
rename(value = tas_change) %>%
bind_rows( group %>%
select(esm, experiment, region, pr_pct) %>%
mutate(metric = 'pr_pct') %>%
rename(value = pr_pct),
group %>%
select(esm, experiment, region, iasd) %>%
mutate(metric = 'iasd') %>%
rename(value = iasd)
) ->
reshaped
reshaped %>%
mutate(row_id = paste0(region, '~', metric),
col_id = paste0(esm, '~', experiment)) %>%
select(-esm, -experiment, -region, -metric)->
reshaped2
colnames(reshaped2) <- c(paste0(unique(reshaped2$col_id)), 'row_id', 'col_id')
rownames(reshaped2) <- paste0(reshaped2$row_id)
reshaped2 %>%
select(-col_id, -row_id) ->
out
return(out)
}
)
# combine columns but then transpose because prcomp wants rows to be observations
# and columns to be variables (but doing it the other way first is easier to code)
data_oos <- t(do.call(cbind, shaped_data) )
print(head(data_oos))
## ARP~tas_change CAF~tas_change CAR~tas_change CAU~tas_change
## CAMS-CSM1-0~ssp126 0.7217781 0.6534092 0.475508 0.7300895
## CAS-ESM2-0~ssp126 2.0265191 1.8180967 1.492090 1.9765572
## NorESM2-LM~ssp126 1.2520806 0.9511384 1.045550 0.9158865
## CAMS-CSM1-0~ssp245 1.6709522 1.4542490 1.049517 1.3288714
## CAS-ESM2-0~ssp245 3.1113657 2.8481375 2.157802 3.2993429
## NorESM2-LM~ssp245 2.4318845 1.9307672 1.687185 1.8836492
## CNA~tas_change EAS~tas_change EAU~tas_change ECA~tas_change
## CAMS-CSM1-0~ssp126 0.7759938 0.9085901 0.7745160 1.211910
## CAS-ESM2-0~ssp126 2.6820074 1.9846920 1.6070172 2.609635
## NorESM2-LM~ssp126 1.6171000 1.5046380 0.8706508 1.390881
## CAMS-CSM1-0~ssp245 1.6812570 1.6386330 1.3628631 1.894644
## CAS-ESM2-0~ssp245 3.4493248 2.8321200 2.5762827 3.720766
## NorESM2-LM~ssp245 2.6619504 2.2367569 1.4423693 2.686145
## EEU~tas_change ENA~tas_change ESAF~tas_change ESB~tas_change
## CAMS-CSM1-0~ssp126 0.9167158 0.8043893 0.7667614 1.021218
## CAS-ESM2-0~ssp126 3.4140956 2.6915503 1.6592021 2.706502
## NorESM2-LM~ssp126 1.0858399 1.6678521 0.7122481 1.502535
## CAMS-CSM1-0~ssp245 2.2344706 1.5855684 1.4426862 2.063195
## CAS-ESM2-0~ssp245 4.4997182 3.4567997 2.7956912 3.879886
## NorESM2-LM~ssp245 2.2651949 2.5853723 1.7763480 2.674217
## MDG~tas_change MED~tas_change NAU~tas_change NCA~tas_change
## CAMS-CSM1-0~ssp126 0.6119823 0.8296688 0.6303114 0.6633229
## CAS-ESM2-0~ssp126 1.2654209 2.1564243 1.4205444 2.1585662
## NorESM2-LM~ssp126 0.6274035 1.1151298 0.7475439 1.0072497
## CAMS-CSM1-0~ssp245 1.1017837 1.6853839 1.1754311 1.4602327
## CAS-ESM2-0~ssp245 2.0888622 3.0475793 2.3410019 2.9260185
## NorESM2-LM~ssp245 1.3869669 2.1306803 1.3459292 1.9168257
## NEAF~tas_change NEN~tas_change NES~tas_change NEU~tas_change
## CAMS-CSM1-0~ssp126 0.7093529 0.9960863 0.6592798 0.8218183
## CAS-ESM2-0~ssp126 1.7042147 3.1938829 1.8943789 2.8294277
## NorESM2-LM~ssp126 0.9057502 1.8234305 0.9511107 0.1583311
## CAMS-CSM1-0~ssp245 1.5184952 2.4272370 1.2954223 2.1983783
## CAS-ESM2-0~ssp245 2.5402157 4.0942992 2.9296383 3.9938224
## NorESM2-LM~ssp245 1.9293972 3.3740005 1.6708657 0.9227301
## NSA~tas_change NWN~tas_change NWS~tas_change NZ~tas_change
## CAMS-CSM1-0~ssp126 0.7697682 0.8965775 0.7295597 0.6059787
## CAS-ESM2-0~ssp126 2.3121250 3.5805288 1.7234034 1.1635820
## NorESM2-LM~ssp126 1.1563389 1.4022229 1.1052824 0.5024006
## CAMS-CSM1-0~ssp245 1.5109118 2.0519331 1.4497935 1.1145002
## CAS-ESM2-0~ssp245 3.5980217 4.6048556 2.6249584 2.0757971
## NorESM2-LM~ssp245 1.9319351 2.8463425 1.8616405 0.8893683
## RAR~tas_change RFE~tas_change SAH~tas_change SAM~tas_change
## CAMS-CSM1-0~ssp126 1.1450339 1.173314 0.7850004 0.8191777
## CAS-ESM2-0~ssp126 4.0870563 3.624416 2.2447860 2.6320442
## NorESM2-LM~ssp126 0.6014593 1.348578 1.2309479 1.4033928
## CAMS-CSM1-0~ssp245 2.7182278 2.204546 1.8140041 1.7141371
## CAS-ESM2-0~ssp245 5.4155208 4.568357 3.2834315 3.9112081
## NorESM2-LM~ssp245 2.7756848 2.712119 2.3486928 2.4016638
## SAS~tas_change SAU~tas_change SCA~tas_change SEA~tas_change
## CAMS-CSM1-0~ssp126 0.9518576 0.5529406 0.5536521 0.5820659
## CAS-ESM2-0~ssp126 1.8615248 1.2712389 1.4723092 1.3208960
## NorESM2-LM~ssp126 1.1034042 0.3040543 1.0110083 0.7660292
## CAMS-CSM1-0~ssp245 1.6162551 0.9787643 1.1351850 1.1412961
## CAS-ESM2-0~ssp245 2.8415605 2.1246256 2.2020138 2.0407419
## NorESM2-LM~ssp245 1.8364705 0.8764018 1.7756570 1.3812190
## SEAF~tas_change SES~tas_change SSA~tas_change SWS~tas_change
## CAMS-CSM1-0~ssp126 0.6953120 0.7674232 0.6695490 0.7899058
## CAS-ESM2-0~ssp126 1.5587777 1.4420453 1.1488427 1.3632827
## NorESM2-LM~ssp126 0.6119415 0.6213770 0.3521886 0.5807868
## CAMS-CSM1-0~ssp245 1.3814979 1.4472710 1.0746667 1.4004190
## CAS-ESM2-0~ssp245 2.4130661 2.2941067 1.8899349 2.1931294
## NorESM2-LM~ssp245 1.5857936 1.4386456 0.7128182 1.2460616
## TIB~tas_change WAF~tas_change WCA~tas_change WCE~tas_change
## CAMS-CSM1-0~ssp126 1.133997 0.6296341 0.9718002 0.9347833
## CAS-ESM2-0~ssp126 2.196524 1.6894468 2.5076589 2.7013104
## NorESM2-LM~ssp126 1.350527 0.9653122 1.2094205 1.0360799
## CAMS-CSM1-0~ssp245 1.865026 1.3922156 1.7213434 1.9612780
## CAS-ESM2-0~ssp245 3.376221 2.6298037 3.5164005 3.8237614
## NorESM2-LM~ssp245 2.391996 1.9196165 2.3520915 1.8998240
## WNA~tas_change WSAF~tas_change WSB~tas_change ARP~pr_pct
## CAMS-CSM1-0~ssp126 0.799322 0.7928992 0.8869747 10.49506
## CAS-ESM2-0~ssp126 2.711045 1.6040664 3.1112262 32.82932
## NorESM2-LM~ssp126 1.375518 0.8253246 1.4505836 29.05729
## CAMS-CSM1-0~ssp245 1.574443 1.6134067 2.0385866 12.78109
## CAS-ESM2-0~ssp245 3.424206 2.6231730 4.4063702 32.06928
## NorESM2-LM~ssp245 2.350320 1.8237557 2.6524102 14.03248
## CAF~pr_pct CAR~pr_pct CAU~pr_pct CNA~pr_pct EAS~pr_pct
## CAMS-CSM1-0~ssp126 2.5422902 -3.2966802 3.032642 4.6096677 3.7539698
## CAS-ESM2-0~ssp126 3.9015089 7.0435917 -7.714344 3.5374403 4.5687909
## NorESM2-LM~ssp126 6.5267202 -0.5447812 -12.237976 -1.6026693 4.3147056
## CAMS-CSM1-0~ssp245 5.1608725 -5.7498342 11.846749 0.4624606 4.8264417
## CAS-ESM2-0~ssp245 0.8366341 1.3246435 -16.206582 5.1130016 3.8919206
## NorESM2-LM~ssp245 9.7195291 -7.5144531 -20.200481 2.0676981 0.9633443
## EAU~pr_pct ECA~pr_pct EEU~pr_pct ENA~pr_pct ESAF~pr_pct
## CAMS-CSM1-0~ssp126 -2.754635 4.463063 9.1266611 3.301678 -0.2873758
## CAS-ESM2-0~ssp126 -10.509468 12.420309 11.8736587 8.761252 -0.2875139
## NorESM2-LM~ssp126 -2.833282 10.060551 -1.7581962 3.034432 -6.1296675
## CAMS-CSM1-0~ssp245 4.859410 9.767051 8.8379499 2.717693 -1.5756765
## CAS-ESM2-0~ssp245 -9.883818 13.726061 18.1565447 9.848803 -2.9041388
## NorESM2-LM~ssp245 -6.769918 8.645732 0.1394985 3.774594 -9.3854325
## ESB~pr_pct MDG~pr_pct MED~pr_pct NAU~pr_pct NCA~pr_pct
## CAMS-CSM1-0~ssp126 6.292838 0.04263978 -4.178746 3.156916 -0.9408235
## CAS-ESM2-0~ssp126 15.254888 0.09891849 6.951420 -5.860434 -3.8273255
## NorESM2-LM~ssp126 5.843237 -7.86127507 -5.779205 -12.369181 2.4553379
## CAMS-CSM1-0~ssp245 9.993381 -1.81829787 -4.654789 10.751355 -3.9161466
## CAS-ESM2-0~ssp245 21.176584 -0.43414069 -3.503420 -6.412492 -6.0862015
## NorESM2-LM~ssp245 5.990293 -7.78499894 -12.422355 -12.147513 -1.8548255
## NEAF~pr_pct NEN~pr_pct NES~pr_pct NEU~pr_pct NSA~pr_pct
## CAMS-CSM1-0~ssp126 3.123002 4.876864 1.51550295 3.316470 -3.289795
## CAS-ESM2-0~ssp126 16.696971 12.995843 -13.26809148 9.147316 -4.984179
## NorESM2-LM~ssp126 8.502985 7.657905 -12.83847255 0.167906 -3.933656
## CAMS-CSM1-0~ssp245 2.115935 9.969547 -0.03385898 9.563652 -3.695070
## CAS-ESM2-0~ssp245 19.992614 14.732181 -16.24609266 14.709085 -14.302207
## NorESM2-LM~ssp245 2.884427 10.635531 -9.40060727 1.524151 -8.470761
## NWN~pr_pct NWS~pr_pct NZ~pr_pct RAR~pr_pct RFE~pr_pct
## CAMS-CSM1-0~ssp126 4.899197 0.6721096 2.4205766 4.680120 4.346756
## CAS-ESM2-0~ssp126 13.064950 7.8552733 0.7935515 19.226116 11.980244
## NorESM2-LM~ssp126 10.848067 6.2698115 1.3760296 6.581143 8.790813
## CAMS-CSM1-0~ssp245 9.604806 3.0905771 1.5266047 11.462287 9.185159
## CAS-ESM2-0~ssp245 18.649139 12.4050758 0.2895821 24.819218 17.385357
## NorESM2-LM~ssp245 13.643531 6.4102765 -2.0198050 14.449636 10.973080
## SAH~pr_pct SAM~pr_pct SAS~pr_pct SAU~pr_pct SCA~pr_pct
## CAMS-CSM1-0~ssp126 -7.919597 -0.03215533 8.536154 4.209346 -2.4559764
## CAS-ESM2-0~ssp126 73.230428 -3.00904514 8.843281 -2.812209 9.0074573
## NorESM2-LM~ssp126 -8.187255 -5.03714490 6.019582 -4.947263 6.4573497
## CAMS-CSM1-0~ssp245 3.807056 -2.25751430 6.252415 2.502484 -0.9178223
## CAS-ESM2-0~ssp245 44.028304 -1.42417452 5.535393 -5.259063 8.8657352
## NorESM2-LM~ssp245 -11.823685 -9.15949459 8.159934 -8.360040 1.0702287
## SEA~pr_pct SEAF~pr_pct SES~pr_pct SSA~pr_pct SWS~pr_pct
## CAMS-CSM1-0~ssp126 1.775624 2.774763 0.4861554 1.1393758 -0.5340962
## CAS-ESM2-0~ssp126 5.679799 9.819449 4.9841720 2.3311193 -5.3252011
## NorESM2-LM~ssp126 -2.782311 9.857415 8.1485958 0.6339715 -1.4386232
## CAMS-CSM1-0~ssp245 4.595084 -1.240647 -0.7625185 0.7761257 -1.6912840
## CAS-ESM2-0~ssp245 4.521503 12.591125 8.7184605 3.3087743 -11.4270495
## NorESM2-LM~ssp245 -4.343809 7.607413 5.9711563 -0.7166809 -5.2480129
## TIB~pr_pct WAF~pr_pct WCA~pr_pct WCE~pr_pct WNA~pr_pct
## CAMS-CSM1-0~ssp126 1.19025588 -3.78791557 -1.094189 3.8722297 4.112405
## CAS-ESM2-0~ssp126 13.81509621 11.50625739 18.500285 8.0318679 7.314359
## NorESM2-LM~ssp126 13.82776853 5.68309452 9.374147 -3.8131401 8.592294
## CAMS-CSM1-0~ssp245 -0.07715752 -0.07245194 3.597095 2.7118636 3.876512
## CAS-ESM2-0~ssp245 17.82014429 4.28528851 11.309811 4.0435061 5.308400
## NorESM2-LM~ssp245 12.25581511 5.21404407 5.274417 -0.4806603 10.457702
## WSAF~pr_pct WSB~pr_pct ARP~iasd CAF~iasd CAR~iasd
## CAMS-CSM1-0~ssp126 -1.5422028 14.0521790 0.3310797 0.3406182 0.1843266
## CAS-ESM2-0~ssp126 -0.8957614 17.3326114 0.3897929 0.3415875 0.2233914
## NorESM2-LM~ssp126 -0.1789890 0.3904907 0.3794299 0.4582858 0.2656871
## CAMS-CSM1-0~ssp245 -1.3315854 12.3422765 0.3448827 0.2937309 0.1711690
## CAS-ESM2-0~ssp245 -1.0684895 23.7691503 0.4053629 0.3522248 0.2142374
## NorESM2-LM~ssp245 -3.4345182 1.8007142 0.3886074 0.4476950 0.2744820
## CAU~iasd CNA~iasd EAS~iasd EAU~iasd ECA~iasd EEU~iasd
## CAMS-CSM1-0~ssp126 0.4651680 0.5538641 0.3169825 0.4210074 0.5339960 0.7102448
## CAS-ESM2-0~ssp126 0.6031425 0.5246637 0.3442479 0.4227117 0.5066082 0.8664715
## NorESM2-LM~ssp126 0.3630293 0.5895711 0.3553272 0.3268056 0.5054689 0.7526778
## CAMS-CSM1-0~ssp245 0.5408617 0.5249440 0.3162161 0.4074184 0.5544549 0.7251083
## CAS-ESM2-0~ssp245 0.6283153 0.5493342 0.3473167 0.4695273 0.5200658 0.8828635
## NorESM2-LM~ssp245 0.3765586 0.6024052 0.3704455 0.3355865 0.4980924 0.8043371
## ENA~iasd ESAF~iasd ESB~iasd MDG~iasd MED~iasd NAU~iasd
## CAMS-CSM1-0~ssp126 0.4058755 0.3076424 0.6348455 0.2393575 0.3330697 0.2835811
## CAS-ESM2-0~ssp126 0.3646702 0.3885021 0.6949840 0.3206487 0.3675448 0.3261236
## NorESM2-LM~ssp126 0.3974191 0.3954677 0.6044290 0.2633963 0.3137626 0.3431205
## CAMS-CSM1-0~ssp245 0.4129294 0.3021863 0.6470716 0.2364843 0.2815867 0.2854634
## CAS-ESM2-0~ssp245 0.4026967 0.4113922 0.6284321 0.3368562 0.3663736 0.3560986
## NorESM2-LM~ssp245 0.3898958 0.4240767 0.6425965 0.2914164 0.3104904 0.3380866
## NCA~iasd NEAF~iasd NEN~iasd NES~iasd NEU~iasd NSA~iasd
## CAMS-CSM1-0~ssp126 0.2909702 0.3362006 0.5292216 0.2906486 0.6079654 0.3594712
## CAS-ESM2-0~ssp126 0.2373821 0.3650802 0.6101460 0.4739786 0.7281592 0.6626688
## NorESM2-LM~ssp126 0.2388460 0.3825416 0.6988230 0.4058428 0.4848327 0.5227993
## CAMS-CSM1-0~ssp245 0.2777738 0.2983937 0.6074753 0.2845567 0.6742705 0.3441835
## CAS-ESM2-0~ssp245 0.2509184 0.3743426 0.6074016 0.5197104 0.6748789 0.6750808
## NorESM2-LM~ssp245 0.2527703 0.3679430 0.6476482 0.3963307 0.4736128 0.5052354
## NWN~iasd NWS~iasd NZ~iasd RAR~iasd RFE~iasd SAH~iasd
## CAMS-CSM1-0~ssp126 0.6549496 0.3450007 0.2381873 0.5332794 0.4653741 0.3457771
## CAS-ESM2-0~ssp126 0.7301214 0.4637771 0.2346622 0.5866083 0.5009976 0.3980868
## NorESM2-LM~ssp126 0.7906462 0.6178580 0.2257027 0.8078162 0.4976550 0.4689875
## CAMS-CSM1-0~ssp245 0.7117423 0.3420295 0.2448729 0.5793005 0.4971873 0.3013138
## CAS-ESM2-0~ssp245 0.7103953 0.4540210 0.2284675 0.5942691 0.5091325 0.4344538
## NorESM2-LM~ssp245 0.7489247 0.6034515 0.2048259 0.7550570 0.6012677 0.5013093
## SAM~iasd SAS~iasd SAU~iasd SCA~iasd SEA~iasd SEAF~iasd
## CAMS-CSM1-0~ssp126 0.4129497 0.2952441 0.2249501 0.2435609 0.2053740 0.2970027
## CAS-ESM2-0~ssp126 0.6568066 0.2945502 0.2176580 0.3044092 0.1558636 0.2889948
## NorESM2-LM~ssp126 0.5358106 0.3964151 0.2225094 0.3977533 0.2155412 0.3210898
## CAMS-CSM1-0~ssp245 0.4061017 0.3132142 0.2117938 0.2291137 0.1967287 0.2652956
## CAS-ESM2-0~ssp245 0.7031886 0.2829637 0.2231870 0.2862329 0.1569489 0.3046800
## NorESM2-LM~ssp245 0.5086716 0.3644162 0.2178362 0.3895901 0.2175913 0.3340867
## SES~iasd SSA~iasd SWS~iasd TIB~iasd WAF~iasd WCA~iasd
## CAMS-CSM1-0~ssp126 0.3586119 0.2553562 0.3066687 0.4298224 0.3152778 0.5181384
## CAS-ESM2-0~ssp126 0.3799761 0.3943700 0.3746925 0.3192836 0.3637637 0.4761333
## NorESM2-LM~ssp126 0.3239222 0.3335389 0.3102176 0.3961806 0.4887202 0.3967190
## CAMS-CSM1-0~ssp245 0.3189576 0.2663580 0.3036856 0.4225975 0.2991585 0.5216636
## CAS-ESM2-0~ssp245 0.3394295 0.3581236 0.3464277 0.3568257 0.3567990 0.4283144
## NorESM2-LM~ssp245 0.2984481 0.3076567 0.3538737 0.3697378 0.4868183 0.3973176
## WCE~iasd WNA~iasd WSAF~iasd WSB~iasd
## CAMS-CSM1-0~ssp126 0.6235452 0.4666619 0.2425287 0.7592543
## CAS-ESM2-0~ssp126 0.7826347 0.5222338 0.2652032 0.8037653
## NorESM2-LM~ssp126 0.5481253 0.5922130 0.3872222 0.6643387
## CAMS-CSM1-0~ssp245 0.5746841 0.4667856 0.2231594 0.6767302
## CAS-ESM2-0~ssp245 0.6803352 0.5261481 0.2862770 0.7466118
## NorESM2-LM~ssp245 0.5407764 0.5440543 0.3734815 0.7042145
data_oos_coords <- predict(data_pca, newdata = data_oos)
print(head(data_oos_coords))
## PC1 PC2 PC3 PC4 PC5
## CAMS-CSM1-0~ssp126 -9.9574483 -0.4684073 -1.0228705 -1.3897210 -0.8941655
## CAS-ESM2-0~ssp126 -3.9102308 -2.5923175 0.9640188 -4.5922076 1.5523318
## NorESM2-LM~ssp126 -8.4986239 -4.9803153 2.2047137 0.6325318 3.3918989
## CAMS-CSM1-0~ssp245 -6.8924903 -0.1902419 -0.6149129 -2.0565257 -1.6221693
## CAS-ESM2-0~ssp245 0.6640701 -3.2643231 1.4929992 -3.3468519 2.5094742
## NorESM2-LM~ssp245 -4.5851166 -4.7896813 3.6677316 1.1149431 3.5975332
## PC6 PC7 PC8 PC9 PC10
## CAMS-CSM1-0~ssp126 -0.9873694 0.9635059 0.7804542112 -0.28241120 -4.1267789
## CAS-ESM2-0~ssp126 1.8890234 1.7075041 0.5613797449 -0.10014715 -2.8151552
## NorESM2-LM~ssp126 3.4600941 -1.9601143 -1.4429313320 -1.98000730 -0.5853057
## CAMS-CSM1-0~ssp245 -1.9620911 0.8977753 -0.0006746853 0.09648266 -2.8807550
## CAS-ESM2-0~ssp245 1.1296116 1.6050837 0.7438923056 -0.08142413 -2.3552294
## NorESM2-LM~ssp245 2.6576479 -1.1572479 -2.2638357771 -2.87628799 -0.7687944
## PC11 PC12 PC13 PC14 PC15
## CAMS-CSM1-0~ssp126 -0.09628748 1.1867099 -0.6671454 1.2387347 0.3326238
## CAS-ESM2-0~ssp126 1.22305338 -0.3078795 -0.4653914 -0.1449952 0.7545106
## NorESM2-LM~ssp126 -0.27202404 1.9228272 1.0818035 -1.2897892 0.8224239
## CAMS-CSM1-0~ssp245 0.53367860 0.2480964 1.5235116 1.8893576 1.5712506
## CAS-ESM2-0~ssp245 -0.09194158 -0.5396456 -0.1304965 -1.1240028 0.9935976
## NorESM2-LM~ssp245 -1.02003006 2.4250411 1.1404197 -1.2457343 1.0146858
## PC16 PC17 PC18 PC19 PC20
## CAMS-CSM1-0~ssp126 -0.02551842 -0.9054927 -1.9912691 -0.3097410 0.6694285
## CAS-ESM2-0~ssp126 -3.59608363 -2.4666798 -1.2607771 1.0412940 0.2163489
## NorESM2-LM~ssp126 -1.94493669 -1.0971814 -0.5436950 2.5924665 -0.3676984
## CAMS-CSM1-0~ssp245 0.87603088 0.9288460 -0.3892036 0.9804936 0.6077519
## CAS-ESM2-0~ssp245 -2.02702696 -2.4070077 -1.1072258 1.5877721 -0.2477387
## NorESM2-LM~ssp245 -1.79167402 -0.6094954 -1.1170700 2.2382198 0.3898787
## PC21 PC22 PC23 PC24 PC25
## CAMS-CSM1-0~ssp126 -0.03133896 -0.85306217 0.09032247 0.8346513 0.6575135
## CAS-ESM2-0~ssp126 1.05130494 -0.46287981 1.95900168 -1.4427707 2.0875998
## NorESM2-LM~ssp126 -0.09311449 0.03248292 0.03379086 -1.7029413 0.8967019
## CAMS-CSM1-0~ssp245 0.29651633 1.36829956 0.21170892 -0.6239436 -0.3668521
## CAS-ESM2-0~ssp245 0.70346654 -1.00629682 1.15098456 -1.0285406 0.6431849
## NorESM2-LM~ssp245 -0.71352619 0.25020446 0.20264879 -0.9038437 1.1182603
## PC26 PC27 PC28 PC29 PC30
## CAMS-CSM1-0~ssp126 -0.53954063 -0.530013259 0.04709689 -0.03269643 -0.14564594
## CAS-ESM2-0~ssp126 1.12694960 -2.112916434 1.86409302 1.16355788 1.45625719
## NorESM2-LM~ssp126 -0.86544878 -0.001884817 -0.67004412 -0.73012305 -1.42043356
## CAMS-CSM1-0~ssp245 0.71176442 -0.067723952 0.15454561 0.16795046 0.06694889
## CAS-ESM2-0~ssp245 1.69516759 -2.384534167 2.18852518 1.23317861 0.69937804
## NorESM2-LM~ssp245 -0.06447835 -1.141395756 0.87291988 -0.22208399 -1.18432559
## PC31 PC32 PC33 PC34 PC35
## CAMS-CSM1-0~ssp126 -0.3548292 0.0233142 0.0242583 0.08780254 -0.24005822
## CAS-ESM2-0~ssp126 1.4124560 1.6318342 -2.1393287 2.43654447 -0.42411582
## NorESM2-LM~ssp126 0.6983717 0.9781849 -0.2024838 1.98656432 0.03767749
## CAMS-CSM1-0~ssp245 0.1782612 -0.1415050 -0.1183887 -0.26292970 -0.29260053
## CAS-ESM2-0~ssp245 1.3563995 1.2667267 -0.7905873 2.21663228 -1.48893682
## NorESM2-LM~ssp245 1.3767188 0.9638446 0.6915286 2.09678497 0.36418335
## PC36 PC37 PC38 PC39 PC40
## CAMS-CSM1-0~ssp126 0.01921617 0.2568223 -0.064246768 0.1765405 -0.02407306
## CAS-ESM2-0~ssp126 -1.26840626 0.8280329 -1.503211514 -2.2061692 2.46958414
## NorESM2-LM~ssp126 -0.59315789 -0.2099553 0.196836192 0.9256151 2.13251087
## CAMS-CSM1-0~ssp245 -0.10557103 -0.1674000 0.001412472 -0.1657438 0.06533121
## CAS-ESM2-0~ssp245 -1.42918474 1.2530097 -1.604231329 -1.3475403 1.79075931
## NorESM2-LM~ssp245 -0.30750591 0.2247919 -0.789210160 1.5719080 1.64545641
## PC41 PC42 PC43 PC44 PC45
## CAMS-CSM1-0~ssp126 -0.089855662 0.09018179 0.07358398 0.03097470 0.03864140
## CAS-ESM2-0~ssp126 -0.684560834 -1.67861706 0.24189032 0.82247266 -0.31267263
## NorESM2-LM~ssp126 1.645866897 -0.55847743 -0.01182963 1.11826681 2.43348287
## CAMS-CSM1-0~ssp245 0.100391949 0.10905660 -0.01667637 0.02714955 -0.06208814
## CAS-ESM2-0~ssp245 0.003307905 -1.43350898 0.66609078 0.40373876 -1.53544433
## NorESM2-LM~ssp245 1.278693862 -0.10868938 0.31237975 0.45046624 1.81798262
## PC46 PC47 PC48
## CAMS-CSM1-0~ssp126 -0.01471793 -0.01496805 7.429821e-15
## CAS-ESM2-0~ssp126 -0.65591801 -0.86464660 -9.130618e-01
## NorESM2-LM~ssp126 0.69400618 0.11204447 8.855699e-01
## CAMS-CSM1-0~ssp245 -0.00808585 -0.01270604 6.786238e-15
## CAS-ESM2-0~ssp245 -0.16384812 -0.40800503 -1.176912e+00
## NorESM2-LM~ssp245 0.46733019 -0.05764148 -6.586390e-02
data_oos_coords %>%
as.data.frame() %>%
mutate(id = row.names(.)) %>%
separate(id, into=c('model', 'scenario'), sep = '~') %>%
select(model, scenario, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9) %>%
mutate(label = 'oos') %>%
bind_rows(coordinates %>% mutate(label = 'training')) ->
coordinates
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC2, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC2, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC2, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC2, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC3, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC3, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC3, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC3, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC4, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC4, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC1, y = PC4, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC1, y = PC4, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC2, y = PC3, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC2, y = PC3, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC2, y = PC3, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC2, y = PC3, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC2, y = PC4, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC2, y = PC4, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC2, y = PC4, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC2, y = PC4, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC3, y = PC4, color = model), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC3, y = PC4, color = model, shape = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
ggplot() +
geom_point(data = coordinates %>% filter(label !='oos'),
mapping = aes(x = PC3, y = PC4, color = scenario), alpha = 0.5) +
geom_point(data = coordinates %>% filter(label =='oos'),
mapping = aes(x = PC3, y = PC4, color = scenario), size =3.5)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
4 PCs for each ESM and compare those? hard to visualize at that point though
compute basis with all esm data and find invariant subspaces?